package VN.EDU.IMIC.DEVELOPER.DOTHANHTUNG.ARRAYLISTBAI3;

import java.util.Comparator;

public class student implements Comparator<student>, Comparable<student> {

	private String studentID;
	private String studentFirstName;
	private String studentLastName;
	private String studentEmail;
	private String studentPhone;
	private double studentMark;

	// constructor

	public student(String studentID, String studentFirstName,
			String studentLastName, String studentEmail, String studentPhone,
			double studentMark) {
		this.studentID = studentID;
		this.studentFirstName = studentFirstName;
		this.studentLastName = studentLastName;
		this.studentEmail = studentEmail;
		this.studentPhone = studentPhone;
		this.studentMark = studentMark;
	}
	
	//properties
	
	public student() {
		// TODO Auto-generated constructor stub
	}

	public String getStudentID() {
		return studentID;
	}

	public void setStudentID(String studentID) {
		this.studentID = studentID;
	}
	
	public String getStudentFirstName(){
		return studentFirstName;
	}
	public void setStudentFirstName(String studentFirstName){
		 this.studentFirstName = studentFirstName;
	}
	
	public String getStudentLastName() {
		return studentLastName;
	}

	public void setStudentLastName(String studentLastName) {
		this.studentLastName = studentLastName;
	}

	public String getStudentEmail() {
		return studentEmail;
	}

	public void setStudentEmail(String studentEmail) {
		this.studentEmail = studentEmail;
	}

	public String getStudentPhone() {
		return studentPhone;
	}

	public void setStudentPhone(String studentPhone) {
		this.studentPhone = studentPhone;
	}

	public double getStudentMark() {
		return studentMark;
	}

	public void setStudentMark(double studentMark) {
		this.studentMark = studentMark;
	}

	@Override
	public int compareTo(student studentobj) {
		//int compareTemp = (int)(studentobj.getStudentMark() * 10);
		// TODO Auto-generated method stub
		//return (int) (compareTemp - this.studentMark * 10);	
		return Double.compare(studentobj.getStudentMark(), this.studentMark);
	}

	

	@Override
	public int compare(student student1, student student2) {
		// TODO Auto-generated method stub
		return student1.getStudentFirstName().toUpperCase().compareTo(student2.getStudentFirstName().toUpperCase());
	}

}
